package com.lightsh.strictmode;

import android.os.StrictMode;

public class StrictModeHelper {
	private static final boolean DEVELOPER_MODE = true;
	/**
	 * 打开检测ANR模式,需要在2.3版本进行
	 * 在application的onCreate()中调用即可
	 */
	public static final void openStrictMode(){
		if(DEVELOPER_MODE){
    		StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
    		.detectDiskReads()
    		.detectDiskWrites()
    		.detectNetwork()
    		.penaltyLog()
    		.build());
    		
    		StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
    		.detectLeakedSqlLiteObjects()
    		.penaltyLog()
    		.penaltyDeath()
    		.build());
    	}
	}
}
